import java.util.Scanner;
import java.util.*;
public class Main {
    //设计一个算法，找出数组中两数之和为指定值的所有整数对。一个数只能属于一个数对
    public static List<List<Integer>> seeknumber(int[] nums,int target){
        List<List<Integer>> res=new ArrayList<>();
        Arrays.sort(nums);
        int l=0,r=nums.length-1;
        while(l<r){
            if(nums[l]+nums[r]==target){
                res.add(Arrays.asList(nums[l],nums[r]));
                l++;
                r--;
            }
            else if(nums[l]+nums[r]<target){
                l++;
            }
            else r--;
        }
        return res;
    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] nums=new int[n];
        for(int i=0;i<n;i++){
            nums[i]=sc.nextInt();
        }
        int target=sc.nextInt();
        List<List<Integer>> list=seeknumber(nums,target);
        System.out.println(Arrays.toString(list.toArray()));
    }
}